package ru.gelin.android.bells;

import ru.gelin.android.bells.timers.Timer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TimePicker;

/**
 *  Activity to add a timer.
 */
public class AddTimerActivity extends SaveTimerActivity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        TimePicker period = (TimePicker)findViewById(R.id.timer_period);
        period.setIs24HourView(true);
        period.setCurrentHour(0);
        period.setCurrentMinute(30);
        View nowButton = findViewById(R.id.timer_start_now);
        nowButton.setVisibility(View.GONE);
        
        final Button button = (Button)findViewById(R.id.submit_button);
        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                addTimer();
            }
        });

    }
    
    void addTimer() {
        Timer timer = new Timer();
        saveTimer(timer);
    }
    
}
